﻿function Text(position, size, imageText) {
    var that = this;
    this.text = svg.append('text')
    .attr("font-size", "9")
    .attr("fill", "rgb(0,0,127)")

    BaseNode.apply(this, [that.text, position, size]);

    this.onUpdateLayout = function () {
        that.text.attr("x", this.getActualPosition().x);
        that.text.attr("y", this.getActualPosition().y);
        that.text.text(imageText);
        if (this.logFlag) {
            worker.postMessage("Create a Text:" + imageText);
        }
        this.logFlag = false;
    };
    this.hitTest = function () {
        return new HitResult(false, 0, 0);
    }

    this.getCenterPos = function () {
        var x = this._position.x + (this._size.w) / 2;
        var y = this._position.y + (this._size.h) / 2;
        return { x: x, y: y };
    }
}